#ifndef __MAIN_H__
#define __MAIN_H__

/* variable definition */
unsigned char timer10msflag;
unsigned char lcdflag=1;
unsigned char counter;

extern unsigned char led[4];
extern unsigned char led_flag;
extern unsigned char leddata[32];
extern unsigned char i2cstrout[I2C_LENGTH];
extern unsigned char i2cstrin[I2C_LENGTH];
typedef union
{   unsigned int  xword;
    struct
    {   unsigned char  low;
        unsigned char  high;
    }xbyte;
}ByteWord;
unsigned char testiicflag;
unsigned char testledflag;


extern unsigned char uartsendptr;
extern unsigned char uartreceptr;
extern unsigned char uartproflag;
extern unsigned char uartsendflag;
extern unsigned char uartsendtempptr;
extern unsigned char xdata uartrecebuf[256];
extern unsigned char xdata uartsendbuf[256];

unsigned char code welcome[]="MCU51's development Board emulation\rEnviroment: Proteus 7.1 SP2 & Keil uVision3.30 & C51 V8.02\rhttp://www.51embed.com\rEmail:huixiong73@gmail.com\rCopyright(C) Xiong,Hui\rVersion:V1.7@2008-4-23\rPlease input a selection(0~9):\r\n";

/* function declaration */
void timer_500ms(void);
extern void uart_rece(void);
extern void key_pro(void);
extern void uart_send(void);
extern void led_disp(void);
extern void lcd_disp(unsigned char data page,unsigned char data line,unsigned char *character);
extern void mcu_init(void);
extern void sys_init(void);

void lcd_pro(void);
extern void lcd_init(void);

extern unsigned char  i2cread(unsigned char page, unsigned char address, unsigned char  size);
extern unsigned char i2cwrite(unsigned char page,unsigned char address,unsigned char size);

void iic_pro(void);
extern void delay( unsigned int i);

void uart_pro(void);
extern void uart_rece(void);

#endif